package com.cloud.utils.hutool.unitTest;

import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.cloud.utils.hutool.ExcelExTendUtils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class test {

    public static void main(String[] args) {
        List<UserScore> list = buildUserScore();
        File f = new File("C:\\Users\\86173\\Desktop\\test.xlsx");
        if(f.exists()){
            f.delete();
        }
        ExcelWriter writer = ExcelUtil.getWriter(f);
        ExcelExTendUtils.exportObj(writer,"2023-07-02成绩",list,UserScore.class);
        writer.flush();
        writer.close();
    }


    private static List<UserScore>  buildUserScore(){
        List<UserScore> list = new ArrayList<>();
        for(int i = 0 ; i< 5 ;i++){
            UserBasicInfo user = new UserBasicInfo(i,"学生"+i,11);
            ScoreInfo   ywScore = new ScoreInfo(i,"语文：",7D+i);
            ScoreInfo   swScore = new ScoreInfo(i,"数学：",7D+i);
            UserScore userScore = new UserScore(user,ywScore,swScore,10D);
            list.add(userScore);
        }
        return list;
    }

}
